Add model version to GenerateContent Output#8227
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the modelVersion property to GenerateContentResponse and its internal representation, updating serialization tests and API definitions accordingly. However, a critical compilation error was introduced in GenerateContentResponse.kt where the text property declaration was accidentally deleted, leaving an orphaned code block.
|
The public api surface has changed for the subproject ai-logic_firebase-ai: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
|
It would be nice if the developer could also get the model name before running Similar to how ML Kit exposes |
|
Could you update some of the tests entries in the https://github.com/FirebaseExtended/vertexai-sdk-test-data and check for it in the tests? |
It would be nice, 100%. Sadly, there's no backend API for it |
@rlazo I don't think we need to match the behavior for Cloud models, since those are specified by the user. val model = Firebase.ai(backend = GenerativeBackend.googleAI())
.generativeModel(
modelName = "gemini-3.1-flash-lite",
onDeviceConfig = OnDeviceConfig(mode = InferenceMode.PREFER_ON_DEVICE)
)
val onDeviceModelName = model.getOnDeviceModelName() // returns null if not availableOr more elegantly, we could put it somehwere in the "Available" status: val statusText = when (FirebaseAIOnDevice.checkStatus()) {
OnDeviceModelStatus.AVAILABLE -> {
"Model available: ${status.modelName}" // <-- getting the model name
}
OnDeviceModelStatus.DOWNLOADABLE -> "Model downloadable"
OnDeviceModelStatus.DOWNLOADING -> "Model downloading..."
OnDeviceModelStatus.UNAVAILABLE -> "On-device model unavailable"
else -> "Unknown"
} |
65810f2 to
a8616bd
Compare
|
The public api surface has changed for the subproject ai-logic_firebase-ai: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
1 similar comment
|
The public api surface has changed for the subproject ai-logic_firebase-ai: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
My mistake! I though you were asking about this in the cloud model context, rather than on the on-device case. We have
Since the introduction of STABLE & PREVIEW models, the API in |
This PR adds to the Firebase Android SDK's
GenerateContentResponseobject the output-onlymodelVersionstring field, which enables developers to identify the exact version of the model that performed the inference.